﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using TT.Module.sysLogin;
using SfcorpDLL.ety;
using SQLHelper;

namespace sfcorp.dao
{
    public class daoCustomerClient
    {
        etyBaeSystemParamter basSysParam;

        public daoCustomerClient(etyBaeSystemParamter ieyBasClassDeclare)
        {
            basSysParam = ieyBasClassDeclare;
        }
        public daoResult Insert_CustomerClient(etyCustomerClient inEty)
        {
            string sql = "insert into R_CLIENT_CUSTOMER(CLIENT_ID,CUSTOMER_ID,REC_NAM,REC_TIM,ENABLE_FLAG,CLIENT_NAM) values(:CLIENT_ID,:CUSTOMER_ID,:REC_NAM,sysdate,:ENABLE_FLAG,:CLIENT_NAM)";
            return basSysParam.SqlHelp.ExecuteTrans(sql, inEty);
        }

        public daoResult Update_CustomerClient(etyCustomerClient inEty)
        {
            string sql = "update R_CLIENT_CUSTOMER set CLIENT_ID=:CLIENT_ID,CUSTOMER_ID=:CUSTOMER_ID,UPDATE_NAM=:UPDATE_NAM,UPDATE_TIM=sysdate,ENABLE_FLAG=:ENABLE_FLAG,CLIENT_NAM=:CLIENT_NAM where  GKEY =:GKEY ";
            return basSysParam.SqlHelp.ExecuteTrans(sql, inEty);
        }

        public daoResult Delete_CustomerClient(etyCustomerClient inEty)
        {
            string sql = "delete R_CLIENT_CUSTOMER where  GKEY =:GKEY " ;
            return basSysParam.SqlHelp.ExecuteTrans(sql, inEty);
        }

        
        public DataTable Get_CustomerClient(etyCustomerClient inEty)
        {
            string sql = "select CLIENT_ID,CUSTOMER_ID,ENABLE_FLAG,CLIENT_NAM,CUSTOMER_NAM,GKEY from V_CUSTOMER_CLIENT  " ;
            return basSysParam.SqlHelp.ExecuteReader(sql, inEty);
        }

    }
}